package com.woniu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.mapper.ChinaMapper;
import com.woniu.pojo.China;
import com.woniu.redis.RedisConst;
import com.woniu.service.ChinaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class ChinaServiceImpl extends ServiceImpl<ChinaMapper, China> implements ChinaService {
    @Autowired
    private ChinaMapper chinaMapper;

    /**
     * 根据省份 id，查询省份名称
     * */
    @Override
    @Cacheable(cacheNames = RedisConst.CHINA_CACHE,key = "#id")
    public China findById(Integer id) {
        // 根据 省份id查询省份名称
        return chinaMapper.selectById(id);
    }
}
